//
//  LBInviteContactsNodataView.m
//  jslj
//
//  Created by 杨庆人 on 2017/11/1.
//  Copyright © 2017年 广东联结电子商务有限公司. All rights reserved.
//

#import "LBInviteContactsNodataView.h"
#import <LBCategory.h>
#import <Masonry.h>
@interface LBInviteContactsNodataView ()
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *inviteBtn;

@end
@implementation LBInviteContactsNodataView

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.textColor = [UIColor darkGray];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UIButton *)inviteBtn {
    if (!_inviteBtn) {
        _inviteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_inviteBtn setTitle:@"手机号直邀" forState:UIControlStateNormal];
        _inviteBtn.titleLabel.font = [UIFont systemFontOfSize:16];
        [_inviteBtn setGradientBlueBackgroundImage];
        _inviteBtn.layer.cornerRadius = 4;
        _inviteBtn.clipsToBounds = YES;
        [_inviteBtn addTarget:self action:@selector(inviteBtnClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _inviteBtn;
}

- (void)inviteBtnClick {
    !self.block ? :self.block();
}

- (instancetype)init {
    if (self = [super init]) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.inviteBtn];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(20);
            make.right.offset(-20);
            make.top.offset(10);
        }];
        [self.inviteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.titleLabel.mas_bottom).mas_offset(40);
            make.left.offset(20);
            make.right.offset(-20);
            make.height.mas_equalTo(46);
        }];
        
        NSString * string = @"未搜索到该联系人，可点击手机号直邀，平台将发送邀请短信给该联系人";
        NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc] initWithString:string];
        [attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor blue] range:[string rangeOfString:@"手机号直邀"]];
        self.titleLabel.attributedText = attrStr;
    }
    return self;
}


@end
